(C) 1996 AROS - The Amiga Replacement OS


NAME
#include <intuition/classes.h>
#include <proto/intuition.h>
BOOL FreeClass()
SYNOPSIS
struct IClass * classPtr

LOCATION
In IntuitionBase at offset 119
FUNCTION
Only for class implementatores.

Tries to free a class which has been created with MakeClass() in the first place. This will not succeed in all cases: Classes which still have living objects or which are still beeing used by subclasses can't simply be freed. In this case this call will fail.

Public classes will always be removed with RemoveClass() no matter if FreeClass() would succeed or not. This gurantees that after the call to FreeClass() no new objects can be created.

If you have a pointer to allocated memory in cl_UserData, you must make a copy of that pointer, call FreeClass() and if the call succeeded, you may free the memory. If you don't follow these rules, you might end up with a class which is partially freed.

INPUTS
classPtr
The pointer you got from MakeClass().
RESULT
FALSE if the class couldn't be freed at this time. This can happen either if there are still objects from this class or if the class is used a SuperClass of at least another class.

TRUE if the class could be freed. You must not use classPtr after that.

NOTES
*Always* calls RemoveClass().

EXAMPLE
// Free a public class with dynamic memory in cl_UserD

int freeMyClass (Class * cl)
{
    struct MyPerClassData * mpcd;

    mpcd = (struct MyPerClassData *)cl->cl_UserData;

    if (FreeClass (cl)
    {
	FreeMem (mpcd, sizeof (struct MyPerClassData));
	return (TRUE);
    }

    return (FALSE);
}

BUGS
SEE ALSO
INTERNALS
MakeClass(), "Basic Object-Oriented Programming System for Intuition" and "boopsi Class Reference" Dokument.

HISTORY
27.01.1997 ldp
Polish
10.12.1996 aros
Moved #include into first column to allow makedepend to see it.
24.10.1996 aros
Use the official AROS macros over the __AROS versions.
28.08.1996 digulla
Proportional gadgets BOOPSI